/**
 * 
 */
package com.google.gwt.indexeddb.client;

import com.google.gwt.core.client.JavaScriptObject;

/**
 * @author Chan Le <gwt /at/ chanvn.com>
 * @see <a href="">W3C </a>
 */
public class IDBKeyRange extends JavaScriptObject {

  protected IDBKeyRange() {
  }

  /**
   * The range is bound on the left side; that is, there is a value that is
   * smaller than all of its elements.
   */
  public static final int LEFT_BOUND = 4;

  /**
   * The range is open on the left side; that is, there is no value that is
   * smaller than all of its elements.
   */
  public static final int LEFT_OPEN = 1;

  /**
   * The range is bound on the right side; that is, there is a value that is
   * larger than all of its elements.
   */
  public static final int RIGHT_BOUND = 8;

  /**
   * The range is open on the right side; that is, there is no value that is
   * larger than all of its elements.
   */
  public static final int RIGHT_OPEN = 2;

  /**
   * The range has a single value.
   */
  public static final int SINGLE = 0;

  /**
   * Creates a new left- and right-bound key range.
   * 
   * @param left The left bound of the key range.
   * @param right The right bound of the key range
   * @param openLeft If true, the range includes the left bound value
   * @param openRight If true, the range includes the right bound value
   * @return The newly created key range
   * @see <a href="http://www.w3.org/TR/IndexedDB/#widl-IDBKeyRange-bound">W3C
   *      IDBKeyRange-bound</a>
   */
  public final native IDBKeyRange bound(Object left, Object right,
      boolean openLeft, boolean openRight) /*-{
		return this.bound(left, right, openLeft, openRight);
  }-*/;

  /**
   * Creates a new left-bound key range.
   * 
   * @param bound The value of the left bound
   * @param open If true, the range includes the left bound value
   * @return The newly created key range
   * @see <a
   *      href="http://www.w3.org/TR/IndexedDB/#widl-IDBKeyRange-lowerBound">W3C
   *      IDBKeyRange-lowerBound</a>
   */
  public final native IDBKeyRange leftBound(Object bound, boolean open) /*-{
		return this.leftBound(bound, open);
  }-*/;

  /**
   * Creates a new key range containing a single value
   * 
   * @param value The single value in the key range
   * @return The newly created key range
   * @see <a href="http://www.w3.org/TR/IndexedDB/#widl-IDBKeyRange-only">W3C
   *      IDBKeyRange-only</a>
   */
  public final native IDBKeyRange only(Object value) /*-{
		return this.only(value);
  }-*/;

  /**
   * Creates a new right-bound key range.
   * 
   * @param bound The value of the right bound of the range.
   * @param open If true, the range includes the right bound value
   * @return The newly created key range
   * @see <a
   *      href="http://www.w3.org/TR/IndexedDB/#widl-IDBKeyRange-upperBound">W3C
   *      IDBKeyRange-upperBound</a>
   */
  public final native IDBKeyRange rightBound(Object bound, boolean open) /*-{
		return this.rightBound(bound, open);
  }-*/;

}
